<template>
  <div id="bar-chart">
    <dv-charts :option="option" />
  </div>
</template>

<script>
import {getWeekSale} from '@/js/db'
export default {
  name: 'BarChart',
  data () {
    return {
      option : {}
    }
  },
  mounted() {
    getWeekSale().then(response => {
      this.option = response.data
      this.$error('近期销量未录入' + response.data.error_date)
    })
    .catch(error => {
      console.error('数据获取失败:', error);
    });
  }
}
</script>

<style lang="less">
#bar-chart {
  width: 40%;
  margin-left: 20px;
  background-color: rgba(6, 30, 93, 0.5);
  border-top: 2px solid rgba(1, 153, 209, .5);
}
#bar-chart .dv-charts-container{
  height: 80%;
}


</style>
